package com.twu.biblioteca;

import com.sun.org.apache.bcel.internal.generic.ARRAYLENGTH;

import java.util.ArrayList;

public class Biblioteca {
    private ArrayList<Book> books ;
    public Biblioteca(){
        books =new ArrayList<Book>();
    }
    public Biblioteca(ArrayList<Book> books){
        this.books=new ArrayList<Book>(books);
    }
    public ArrayList<Book> getListofBook(){
        ArrayList<Book> b= new ArrayList<Book>();
        for(Book book:books){
            if(!book.isChecked())
                b.add(book);
        }
        return b;
        
    }

    public Book getBookbyId(int bookid) {
        Book book = null;
        for(Book b: books){
            if(b.getId()==bookid)
                book=b;
        }
        return book;
    }

    public void addNewBook(Book title1) {
        books.add(title1);

    }
}
